#import "SEGQueryisauthManager.h"

#if __has_include(<Commom/SEGModel.h>)
#import <Commom/SEGModel.h>
#else
#import "SEGModel.h"
#endif
#if __has_include(<Commom/SEGHTTPBusinessManager.h>)
#import <Commom/SEGHTTPBusinessManager.h>
#else
#import "SEGHTTPBusinessManager.h"
#endif

static id _queryIsAuthManager;
static dispatch_once_t onceToken;

@implementation SEGQueryisauthManager
#pragma mark - SINGLE----BEGIN----
+(instancetype)sharedManager{
dispatch_once(&onceToken, ^{
_queryIsAuthManager = [[self alloc] init];
});
return _queryIsAuthManager;
}

+(void)destroyResource{
onceToken = 0;
_queryIsAuthManager = nil;
}

#pragma mark - SINGLE----END----

#pragma mark - HTTP----BEGIN----

/// 判断是否认证
/// @see http://192.168.1.11:9090/html/web/controller/share/share.html#5ef84581726846c8c24d5000
/// @param houseId 房屋ID
/// @param communityId 项目ID
/// @param custType 认证类型，（业主认证传：1000）
/// @param finished 0 验证成功
-(void)requestQueryisauthWithHouseid:(NSString*)houseId communityId:(NSString*)communityId custType:(NSString*)custType finished:(void(^)(BOOL isSuccessed,id result,NSString* codeType,NSString* errorMessage))finished{

NSMutableDictionary *params = [NSMutableDictionary dictionary];
[params setValue:houseId forKey:@"houseId"];
[params setValue:communityId forKey:@"communityId"];
[params setValue:custType forKey:@"custType"];

NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/uhomecp-sso/v2/userHouse/queryIsAuth",nil];
[SEGHTTPBusinessManager seg_requestWithMethod:GET URLString:urlString parameters:params completed:^(BOOL isSuccessed, id result, NSString *codeType, NSError *error) {
if (!isSuccessed) {
finished(isSuccessed,nil,codeType,error.localizedDescription);
return;
}

self.queryIsAuth = [SEGQueryisauthModel yy_modelWithDictionary:result];
finished(isSuccessed,result,codeType,error.localizedDescription);
return;
}];
}
#pragma mark - HTTP----END----

#pragma mark - GETTER----BEGIN----
-(SEGQueryisauthModel *)queryIsAuth{
if (!_queryIsAuth) {
_queryIsAuth = [[SEGQueryisauthModel alloc]init];
}
return _queryIsAuth;
}
#pragma mark - GETTER----END----
@end
